package cn.nabaixin.sign;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import cn.nabaixin.R;
import cn.nabaixin.utils.AppUtils;
/**
 * 签到详情界面
 * @author ZWH
 *
 */
public class SignDetailActivity extends Activity {

	private ListView lv;
	private SimpleAdapter sa;
	private List<Map<String, Object>> data;
	private View headerView;
	private TextView footView;
	private Context c;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.sign_detail);
		
		c = SignDetailActivity.this;
		initViews();
		initListener();
		initData();
		
	}
	private void initViews() {
		lv = (ListView) findViewById(R.id.cmts_list);
		headerView = getLayoutInflater().inflate(R.layout.sign_detail_list_header, null);
		lv.addHeaderView(headerView);
		lv.setCacheColorHint(0);
		
	}
	
	private void initListener() {
		
	}
	
	private void initData() {
		String names[] = new String[]{"张三", "李四", "王五"};
		String contents[] = new String[]{"状态好才是真的好!状态好才是真的好！", "好好学习天天向上！哈哈哈哈哈哈哈哈！！！！！", "招行行长:房价上涨是因为百姓手中钱太多？？？"};
		String sendTiems[] = new String[]{"一周前", "两天前", "一天前", "上午", };
		
		data = new ArrayList<Map<String,Object>>();
		for(int i=0; i<10; i++){
			HashMap<String, Object> item = new HashMap<String, Object>();
			item.put("name", AppUtils.getRandomItem(names));
			item.put("content", AppUtils.getRandomItem(contents));
			item.put("sendtime", AppUtils.getRandomItem(sendTiems));
			data.add(item);
		}
		
		sa = new SimpleAdapter(c, data, R.layout.sign_detail_list_item, 
				new String[]{"name", "sendtime", "content"}, 
				new int[]{R.id.cmt_userName, R.id.cmt_sendTime, R.id.cmt_content});
		lv.setAdapter(sa);

	}
}
